package com.lovo;

public class Homework01 {
    public static void main(String[] args) {
        PropertiesUtil prop = new PropertiesUtil();
//        prop.setProperty("name","小王");
//        prop.setProperty("age","30");
//
//        prop.store("2.properties",null);

//        prop.load("2.properties");
//        System.out.println(prop.getProperty("name"));

        // 将下面字符串?后面的键值对保存到proerties文件中
        String url = "http://www.lovo.com/index?name=aaaaaa&age=20&gender=男&phone=13888888888&addr=成都玉双路";
        int index = url.indexOf("?");
        String query = url.substring(index + 1);
        System.out.println("query:" + query);
        String [] kvs = query.split("&");
        for(int i = 0;i < kvs.length;i++){
            String [] strs = kvs[i].split("=");
            prop.setProperty(strs[0],strs[1]);

        }
        prop.store("query.properties",null);

    }
}
